import { WeaInputSearch ,WeaLocaleProvider} from 'ecCom';
import { Menu } from 'antd';
import { observer } from 'mobx-react';
const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class TaskList extends React.Component {
    render() {
        const { store } = this.props;
        return (
            <div className="edc-data-task-list edc-task-left">
                <div className="search-wrapper">
                    {/* {getLabel('21979','全部类型') } */}
                    <span onClick={this.clickAll} className="search-all" title={getLabel(21979,'全部类型')}>{getLabel(21979,'全部类型')}</span>
                    <WeaInputSearch ecId={`${this && this.props && this.props.ecId || ''}_WeaInputSearch@v2iik3`} onSearch={this.onSearch} onChange={this.onSearch} />
                </div>
                <div className="list-wrapper">
                    <Menu ecId={`${this && this.props && this.props.ecId || ''}_Menu@fblhom`}
                        onClick={this.onClick}
                        selectedKeys={[store.selectedTask]}
                    >
                        {store.apps.map(menu => (
                            <Menu.Item ecId={`${this && this.props && this.props.ecId || ''}_MenuItem@drjlon@${menu.id}`} key={menu.id} className="no-line-height">
                                <div className="main">{menu.name}</div>
                                <div className="desc">
                                    <span>{menu.creater}</span>
                                    <span>{menu.createDate}</span>
                                    <span>{menu.createTime}</span>
                                </div>
                            </Menu.Item>
                        ))}
                    </Menu>
                </div>
            </div>
        )
    }
    onClick = ({ key }) => {
        const { store } = this.props;
        store.changeSelectedTask(key);
    }

    onSearch = (searchValue) => {
        const { store } = this.props;
        store.setLeftSearchValue(searchValue);
    }
    clickAll = () => {
        this.onClick({ key: '' });
    }
}